package han;

import java.util.Scanner;
//주의 : SCanner 클래스를 이용해서 입력처리하고 close()를 하게 되면 다시 Scanner  생성불가

public class J10SungJuk {

		public static void main(String[] args) {
			String name;
			int kor = 0, eng = 0,mat = 0,tot = 0;
			double avg = 0;
			char grd = ' ';
			
			String result ="";
			String result1 ="";
			//성적입력
			//성적처리
			
		/* sc = new Scanner(System.in);
		 System.out.println("이름을 입력하세요");
		 name = sc.next();
		 System.out.println("국어점수를 입력하세요");
		 kor = sc.nextInt();
		 System.out.println("영어점수를 입력하세요");
		 eng = sc.nextInt();
		 System.out.println("수학점수를 입력하세요");
		 mat = sc.nextInt();
		 sc.close();*/
		 
		 
		 
		 
		 
		 name = inputName(makeScanner());
		 kor=inputKor(makeScanner());
		eng=inputEng(makeScanner());
		 mat = inputMat(makeScanner());
		 tot = getTotal(kor, eng, mat, tot);
		 avg = getAvgerage(avg, tot);
	     grd = gerGrade(avg, grd);
	     result1+="이름\t\t"+"국어\t"+"영어\t"+"수학\t"+"총점\t"+"평균\t"+"학점\n";
	     result+=name+"\t"+kor+"\t"+eng+"\t"+mat+"\t"+tot+"\t"+avg+"\t"+grd+"\n";	
	     System.out.println(result1);
	     System.out.println(result);
	   /*  System.out.println(name);
			System.out.println(kor);
			System.out.println(eng);
			System.out.println(mat);
			System.out.println(tot);
			System.out.println(avg);
			System.out.println(grd);*/
			
		}
	
		
			
			
			
			public static int getTotal(
				int kor, int eng, int mat,int tot){
			  return tot = kor+eng+mat;
			}
		public static double getAvgerage(double avg,int tot){
			return avg = (double)tot / 3;
		}
		public static char gerGrade(double avg, char grd){

			switch((int)avg/10){
			case 10 : grd = '수' ;break;
			case 9 : grd = '수'; break;
			case 8 : grd = '우'; break;
			case 7 : grd = '미'; break;
			case 6 : grd = '양'; break;
			default : grd='가';
		}
			return grd;
		}
		public static String inputName(Scanner sc){

			String name;
			System.out.println("이름을 입력하세요");
			name = sc.next();
		
			return name;
		}
		//Scanner 생성
		//Scanner 소멸
		public static Scanner makeScanner(){
			Scanner sc = new Scanner(System.in);
			return sc;
		}
		public static void closeScanner(Scanner sc){
			sc.close();
		}
			public static int inputKor(Scanner sc){
				int kor;
				System.out.println("국어 점수를입력하세요?");
				kor = sc.nextInt();
				
				return kor;
			}
			public static int inputEng(Scanner sc){
				int eng;
				System.out.println("영어 점수를입력하세요?");
				eng = sc.nextInt();
				
				return eng;
			}
			public static int inputMat(Scanner sc){
				int mat;
				System.out.println("수학 점수를입력하세요?");
				mat = sc.nextInt();
				closeScanner(sc);
				return mat;
			}
	}

